package com.xiao.dao;

import com.xiao.pojo.Appointment;
import com.xiao.pojo.Books;
import com.xiao.pojo.Borrow;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface BookMapper {
    //增加一本书
    int addBook(Books books);
    //删除一本书
    int deleteBookById(@Param("bookID") int id);
    //修改一本书
    int updateBook(Books books);
    //查询一本书
    Books queryBookById(@Param("bookID") int id);
    //查询全部的书
    List<Books> queryAllBook();
    //通过书名查一本书
    Books queryBookByName(@Param("bookName") String name);
    //添加一个借书记录
    int addBorrow(Borrow borrow);
    //根据学生号查询借阅记录
    List<Borrow> queryAllBorrowBySno(String sno);
   //查询全部借阅记录
    List<Borrow> queryAllBorrow();

    //根据借书bookID还书
int returnBook(int bookID);
//根据id书的库存-1
    int reduceBook(int bookID);
    //根据id书的库存+1
    int increaseBook(int bookID);
    int addAppoint(Appointment appointment);
    int deleteAppoint(String aid);

    List<Appointment> queryAllAppoint();

    List<Appointment> queryAllAppointBySno(String sno);

    //更新状态
    int changeState(@Param("aid") String aid,@Param("state") int state);

    Appointment queryAppointByAid(String aid);
}
